<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!doctype html>
<html class="no-js">
<jsp:include page="../common/common-head.jsp"/>
<body>
<!-- Main wrapper -->
<div class="wrapper" id="wrapper">
  <!-- Header -->
  <jsp:include page="../common/common-top.jsp"/>

  <!-- //Header -->

  <!-- Start Bradcaump area -->
  <div class="ht__bradcaump__area bg-image--3">
    <div class="container">
      <div class="row">
        <div class="col-lg-12">
          <div class="bradcaump__inner text-center">
            <h2 class="bradcaump-title">购物车</h2>
            <nav class="bradcaump-content">
              <a class="breadcrumb_item" href="/">Home</a>
              <span class="brd-separetor">/</span>
              <span class="breadcrumb_item active">购物车</span>
            </nav>
          </div>
        </div>
      </div>
    </div>
  </div>
  <!-- End Bradcaump area -->


  <!-- Start Shop Page -->
  <div class="cart-main-area section-padding--lg bg--white">
    <div class="container">
      <div class="row">
        <div class="col-md-12 col-sm-12 ol-lg-12">
          <form action="#">
            <div class="table-content wnro__table table-responsive">
              <table>
                <thead>
                <tr class="title-top">
                  <th class="product-thumbnail">封面</th>
                  <th class="product-name">图书名</th>
                  <th class="product-price">价格</th>
                  <th class="product-quantity">数量</th>
                  <th class="product-subtotal">总价</th>
                  <th class="product-remove">操作</th>
                </tr>
                </thead>
                <tbody>
                <c:forEach items="${dtoList}" var="item">
                  <tr>
                    <td class="product-thumbnail">
                      <a href="/goods/detail/${item.goodsId}">
                        <img src="${item.goodsPath}" alt="product img">
                      </a>
                    </td>
                    <td class="product-name"><a href="/goods/detail/${item.goodsId}">${item.goodsName}</a></td>
                    <td class="product-price"><span class="amount">$${item.goodsMoney}元</span></td>
                    <td class="product-quantity">${item.num}</td>
                    <td class="product-subtotal">$${item.num * item.goodsMoney}元</td>
                    <td class="product-remove"><a href="/ordersItem/delete/${item.id}">X</a></td>
                  </tr>
                </c:forEach>

                </tbody>
              </table>
            </div>
          </form>
        </div>
      </div>
      <div class="row">
        <div class="col-lg-6 offset-lg-6">
          <div class="cartbox__total__area">
            <div class="cart__total__amount">
              <span style="cursor: pointer" onclick="jiesuan()">去结算</span>
              <span>总价：$${total}元</span>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
  <!-- End Shop Page -->
  <!-- Footer Area -->
  <jsp:include page="../common/common-footer.jsp"/>
  <!-- //Footer Area -->
</div>
<!-- //Main wrapper -->


<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h4 class="modal-title" id="exampleModalLabel">订单信息</h4>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
            aria-hidden="true">&times;</span></button>
      </div>
      <div class="modal-body">
        <form method="post" action="/orders/update" id="form">
          <div class="form-group">
            <label  class="control-label">联系方式:</label>
            <input type="text" class="form-control" name="phone">
          </div>
          <div class="form-group">
            <label class="control-label">备注:</label>
            <textarea class="form-control" name="remark"></textarea>
          </div>
        </form>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="submit" class="btn btn-primary" form="form">结算</button>
      </div>
    </div>
  </div>
</div>


<jsp:include page="../common/common-script.jsp"/>
<script>
  function jiesuan() {
    $("#exampleModal").modal("show");
  }
</script>
</body>
</html>
